<template>
  <div>
    <input v-model="cval">
    <button @click="changeParentValue">改父组件信息</button>
  </div>
</template>

<script>
export default {
  name: 'Child2',
  props: {
    "val": {
      type: String
    }
  },
  data() {
    return {
      cval: this.val
    }
  },
  methods: {
    changeParentValue() {
      this.$emit("changeValue",this.cval)
    }
  },
  watch:{
    cval(val){
      // this.$emit("changeValue",val)
      this.$emit("input",val)
    }
  }
}
</script>

<style scoped lang="scss">

</style>
